extends Camera2D
@export var follow:Node2D
@onready var state_chart: StateChart = $StateChart
@onready var state_script: Node = $StateScript
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
	assert(follow)
	self.limit_left=-2000
	self.limit_bottom=0
	self.limit_top=-2166
	self.limit_enabled=true
	Global.camera_effect.connect(func(str:String):
		if str=="dwell_frame":
			Engine.time_scale=0.1
			await get_tree().create_timer(0.1,true,false,true).timeout
			Engine.time_scale=1
		else:state_chart.send_event(str)
		)
func look_at_pos(pos:Vector2)->void:
	state_script.look_at_position=pos
	state_chart.send_event("look_at")

func follow_player()->void:
	state_chart.send_event("follow")
	
func shake()->void:
	state_chart.send_event("shake")
func tilt()->void:
	state_chart.send_event("tilt")
func dwell_frame()->void:
	state_chart.send_event("dwell_frame")
func _physics_process(delta: float) -> void:
	RenderingServer.global_shader_parameter_set("zoom",self.zoom)
